package Model;

//import java.sql.*;
import java.util.ArrayList;

import javax.swing.plaf.LabelUI;

import DataLayer.DaoAccount;

public class Account implements Comparable<Account> {

	@Override
	public String toString() {
		return "Account [accountNumber=" + getAccountNumber() + ", type=" + getType()
				+ ", accountName=" + getAccountName() + ", interests=" + getInterests()
				+ ", balance=" + getBalance() + "]";
	}


	private String accountNumber;
	private int Gebruiker_ID; 
	private String type;
	private String accountName;
	private Double interests;
	private Double balance;
	
	
	private ArrayList<Transactie> transacties;
	
	private ArrayList<TransactieType> transtype1;
	

	public Account(String accountNumber, int gebruiker_ID, String type,
			String accountName, Double interests, Double balance,
			ArrayList<Transactie> transacties,
			ArrayList<TransactieType> transtype1) {
		
		this.accountNumber = accountNumber;
		Gebruiker_ID = gebruiker_ID;
		this.type = type;
		this.accountName = accountName;
		this.interests = interests;
		this.balance = balance;
		this.transacties = transacties;
		this.transtype1 = transtype1;
	}
	public Account(String accountNumber, String type,
			String accountName, Double interests, Double balance) {
		
		this.accountNumber = accountNumber;
		this.type = type;
		this.accountName = accountName;
		this.interests = interests;
		this.balance = balance;
	}


	public Account() {
		
	}
	
	public String getAccountNumber() {
		return accountNumber;
	}
	public void setAccountNumber(String accountNumber) {
		this.accountNumber = accountNumber;
	}
	public int getGebruiker_ID() {
		return Gebruiker_ID;
	}
	public void setGebruiker_ID(int gebruiker_ID) {
		Gebruiker_ID = gebruiker_ID;
	}
	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getAccountName() {
		return accountName;
	}

	public void setAccountName(String accountName) {
		this.accountName = accountName;
	}

	public Double getInterests() {
		return interests;
	}

	public void setInterests(Double interests) {
		this.interests = interests;
	}

	public Double getBalance() {
		return balance;
	}

	public void setBalance(Double balance) {
		this.balance = balance;
	}

	public ArrayList<Transactie> getTransacties() {
		return transacties;
	}

	public void setTransacties(ArrayList<Transactie> transacties) {
		this.transacties = transacties;
	}

	public ArrayList<TransactieType> getTranstype1() {
		return transtype1;
	}

	public void setTranstype1(ArrayList<TransactieType> transtype1) {
		this.transtype1 = transtype1;
	}

	/*
	 * Bereken bedrag  returned saldo
	 */
	public double berekenBedrag(){
		double saldo = 0;
		double tempbedrag = 0;
		String tsType;
		for(int i = 0;i < transacties.size(); i++){
			tempbedrag = transacties.get(i).getTransactionAmount();
			tsType = transacties.get(i).getTransType().getTransactietype_naam(); 
			if(tsType.equals("Inkomsten")){
				saldo = saldo + tempbedrag;
			}
			else{
				saldo = saldo - tempbedrag; 
				
			}
		}
		
		return saldo;
	}
	
	
	public int compareTo(Account o) {
		if(accountNumber.compareTo(o.getAccountNumber()) == 0){
			
		}
		return accountNumber.compareTo(o.accountNumber);
	}
	
}
